package T01_test_all.test15_stringTest;

public class T03_StringCompare {
    public static void main(String[] args) {
        String strA = "abcde";
        String strB = "deabc";
        boolean result = getCompare(strA,strB);
        System.out.println(result);

    }

    public static Boolean getCompare(String strA, String strB){
        for (int i = 0; i < strA.length(); i++) {
//            strA = stringChange(strA);
            strA = stringChange2(strA);
            System.out.println(strA);
            if(strA.equals(strB)){
                return true;
            }
        }
        return false;
    }

    public static String stringChange(String str){
        char ch = str.charAt(0);
        String newStr = str.substring(1);
        return newStr + ch;
    }

    public static String stringChange2(String str){
        char[] ch = str.toCharArray();
        char first = ch[0];
        for (int i = 1; i < str.length(); i++) {
            ch[i-1] = ch[i];
        }
        ch[ch.length - 1] = first;
        String result = new String(ch);
        return result;
    }
}
